# Contributor: André Klitzing <aklitzing@gmail.com>
# Maintainer: André Klitzing <aklitzing@gmail.com>
pkgname=monero
pkgver=0.16.0.0
pkgrel=0
_ver_randomx=1.1.7
pkgdesc="Secure, private, untraceable cryptocurrency"
url="https://getmonero.org/"
arch="all !aarch64 !mips !mips64" # build failure
license="BSD-3-Clause"
makedepends="boost-dev cmake cppzmq libsodium-dev miniupnpc-dev openssl-dev
	openpgm-dev rapidjson-dev readline-dev unbound-dev zeromq-dev"
options="!check"
source="$pkgname-$pkgver.tar.gz::https://github.com/monero-project/monero/archive/v$pkgver.tar.gz
	$pkgname-randomx-$_ver_randomx.tar.gz::https://github.com/tevador/RandomX/archive/v$_ver_randomx.tar.gz
	easylogging.patch
	system-miniupnpc.patch
	version-string.patch
	"

build() {
	rm -fr external/randomx
	ln -s $srcdir/RandomX-$_ver_randomx external/randomx
	mkdir -p build && cd build
	cmake -DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=None \
		-DSTACK_TRACE=OFF \
		-DMANUAL_SUBMODULES=1 \
		..
	make
}

package() {
	mkdir -p "$pkgdir"/usr/bin
	install -m755 -t "$pkgdir"/usr/bin build/bin/*
}

sha512sums="a81e9c8b7bd6679bb84970831713dae047e1df74a690cdf9b122d6722e6b1920c27e65061d42aaa33d93d6fb52bca0a91572f758c359df049e722023ff9be5a4  monero-0.16.0.0.tar.gz
5987ebb26750b30cffcf8b345c94ee38f49b69f3fbc7f5b3fdd32e98c704ce2bf16a2dace523bfe2b6e9a46d4faa3c6f3317c6b435f0515aa518c920dce061be  monero-randomx-1.1.7.tar.gz
c149f1e6a6968115f95213d512116457b36665ff1159c5137dda45fa27712ce6f088b908663fb429b8e5f74e41d6cd57669db79d596564ddaca481dbdc63393e  easylogging.patch
70c8e981d87442e0c8eccb6804af8ba78c312cfeb547957b20c8e4e83e533f161ce1b094891a99df4113e901f43954a0f1473e39781e8dae77faa0726132563b  system-miniupnpc.patch
087e48b0507c0fb7cc9dbab05b0373b61687de3935642299c6df0194539934e7cccad497435c32291c063b10f4d91d4fbc98d81e269148c4e14780ed38d43559  version-string.patch"
